<template>
	<view class="set">
		<view class="content">
			<view class="searchLine dFlex jBetween_aCenter">
				<view class="line_content dFlex jStart_aCenter">
					<!-- <view class="line_logo imgPublic">
						<image src="/static/logo.png" mode="widthFix"></image>
					</view> -->
					<text>{{$t('set.line_title1')}}</text>
				</view>
				<view class="line_val dFlex jEnd_aCenter" @click='chooseLanguage'>
					<text v-if='showLanguage == "zh"'>中文</text>
					<text v-else-if='showLanguage == "en"'>English</text>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showLanguage:'',
				language:['zh','en'],
			};
		},
		onShow(){
			this.showLanguage = uni.getStorageSync('language') || 'zh';
		},
		methods:{
			chooseLanguage(){
				uni.showActionSheet({
					itemList:['中文','English'],
					success: (e) => {
						this.showLanguage = this.language[e.tapIndex];
						this.$i18n.locale = this.showLanguage;
						uni.setStorageSync('language',this.showLanguage);
						this.common.setShowTab(this);
						/* uni.setTabBarItem({
							index: 0,
							text: this.$t('tabbar.score'),
						})
						uni.setTabBarItem({
							index: 1,
							text: this.$t('tabbar.more'),
						})
						uni.setTabBarItem({
							index: 2,
							text: this.$t('tabbar.tool'),
						})
						uni.setTabBarItem({
							index: 3,
							text: this.$t('tabbar.set'),
						}) */
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.content{
		.searchLine{
			.line_val{
				width: 170px;
			}
			.line_content{
				.line_logo{
					width:25px;
					height:25px;
					margin-right: 8px;
				}
				flex:1;
				margin-right: 12px;
			}
			padding: 12px;
			border-bottom:0.5px solid #dddddd;
		}
		.searchLine:last-child{
			border: none;
		}
		width:100%;
		border: 0.5px solid #dddddd;
	}
	.set{
		width:100%;
		padding:12px 20px;
		box-sizing: border-box;
	}
	page{
		background: white;
	}
</style>
